Current Location: Home> Function Categories> ceil

ceil

Further method to sort
Name:ceil
Category:math
Programming Language:php
One-line Description:Round up to the closest integer.

Definition and usage

ceil() function is rounded up to the closest integer.

Example

In this example, we will apply the ceil() function to different values:

 <?php
echo ( ceil ( 0.60 ) ;
echo ( ceil ( 0.40 ) ;
echo ( ceil ( 5 ) ;
echo ( ceil ( 5.1 ) ;
echo ( ceil ( - 5.1 ) ;
echo ( ceil ( - 5.9 ) ) ;
?>

Try it yourself

grammar

 ceil ( x )
parameter describe
x Required. A number.

illustrate

Returns the next integer not less than x , and if x has a decimal part, it will be added to one. The type returned by ceil() is still float, because the range of float values ​​is usually larger than integer.

Similar Functions